chmod 755 net-server
action=$1;
start(){
  nohup ./net-server >nohup.out 2>&1 &
  echo $! > net.pid
  echo "start success"
}

stop(){
  kill `cat net.pid`
  sleep 1
  rm -f net.pid
  echo "stop success"
}

restart(){
  stop
  sleep 2
  start
}

case "$action" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
   restart
   ;;
  *)
  echo "start|stop|restart"
   ;;
esac
exit 0
